home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 11 code / Async Sound Helper / SoundHelper / SHPrivate.h next >
Encoding:
Text File  |  1995-04-14  |  3.8 KB  |  76 lines  |  [TEXT/MPCC]

  1. //=======================================================================================
  2. //
  3. // SHPrivate.h - private header for the Asynchronous Sound Helper
  4. //
  5. // Written by Bryan K. Ressler (Beaker), 2/4/92
  6. //    Updated by Bradley D. Mohr, 2/4/95
  7. //
  8. // Version 1.00, 2/4/92        Original version
  9. //         1.01, 2/20/92    Added SHGetState to fix handle semaphore problem
  10. //         1.02, 3/21/92    Make handle/error checks more explicit, modify
  11. //                             SHPlayStopByRec (to handle channels with no synthesizer)
  12. //         1.03, 4/4/92        Modifications per KO, RC, JR.  Public routines now pascal.
  13. //         1.04, 4/20/92    Reverted to SHPlayPause/SHPlayContinue structure.
  14. //           1.04a 2/4/95        Updated to worth with Universal Headers & SM 3.0 (BDM)
  15. //
  16. //=======================================================================================
  17.  
  18. //=======================================================================================
  19. // Includes
  20. //=======================================================================================
  21. #include "Std.h"
  22.  
  23. //=======================================================================================
  24. // Contants used by the Asynchronous Sound Helper
  25. //=======================================================================================
  26. #define kSHDefChannels        4        // Default number of channels to preallocate
  27. #define kSHCompleteSig        'SH'    // Flag we use to know a "true" completion callback
  28. #define kSHComplete            'SHcp'    // Flag that a given channel has completed playback
  29. #define kSHHeaderSlop        100        // Extra bytes for the sound header when recording
  30. #define kSHBaseNote            60        // Middle C base note for new recordings
  31. #define kSHSyncWaitTimeout    60        // Ticks to sync-wait when killing the Helper
  32.  
  33. //=======================================================================================
  34. // Constants that should be in Sound.h but aren't
  35. //=======================================================================================
  36. #define kSHNoSynth            0        // Don't associate any synth to this channel
  37. #define kSHNoInit            0        // No specific initialization
  38. #define kSHQuietNow            true    // Stop playing this sound immediately
  39. #define kSHAsync            true    // Play asynchronously
  40. #define kSHWait                false    // Wait for there to be enough room in the queue
  41.  
  42. //=======================================================================================
  43. // Structures
  44. //=======================================================================================
  45. typedef struct {
  46.     SndChannel    channel;            // Our sound channel
  47.     long        refNum;                // Our Helper ref num
  48.     Handle        sound;                // The sound we're playing
  49.     Fixed        rate;                // The rate at which a sampled sound is playing
  50.     char        handleState;        // The handle state to restore this handle to
  51.     Boolean        inUse;                // Tells whether this SHOutRec is in use
  52.     Boolean        paused;                // Tells whether this sound is currently paused
  53. } SHOutRec, *SHOutPtr;
  54.  
  55. typedef struct {
  56.     short        numOutRecs;            // The number of output records in outArray
  57.     SHOutRec    *outArray;            // Our pre-allocated output records
  58.     long        nextRef;            // The next available output reference number
  59. } SHOutputVars;
  60.  
  61. typedef struct {
  62.     long        inRefNum;            // Sound Input Manager's device refNum
  63.     SPB            inPB;                // The input parameter block
  64.     Handle        inHandle;            // The handle we're recording into
  65.     short        headerLength;        // The length of the sound's header
  66.     Boolean        recording;            // Tells whether we're actually recording
  67.     Boolean        recordComplete;        // Tells whether recording is complete
  68.     OSErr        recordErr;            // Error, if error terminated recording
  69.     short        numChannels;        // Number of channels for recording
  70.     short        sampleSize;            // Sample size for recording
  71.     Fixed        sampleRate;            // Sample rate for recording
  72.     OSType        compType;            // Compression type for recording
  73.     Boolean        *appComplete;        // Flag to caller that recording is done
  74.     Boolean        paused;                // Tells whether recording has been paused
  75. } SHInputVars;
  76.